<?php
	require_once (dirname(__FILE__)."/../../config/Config.inc");
	require_once (dirname(__FILE__)."/../../config/api.inc");
	require_once ("load.php");
	
	$parm = requestArrayParm($_REQUEST);
	
	$result['status'] = '1';
	
	$resData = _SqlTool::getList('yqguize');
	
	if(!empty($resData))
	{
		unset($list);
		foreach ($resData as $key => $va)
		{
			$list[$va['type']] = $va;
		}
	}
	
	$result['yqm'] = base_convert($userinfo['id'],10,36);
	
	$result['data1'] = $list['1'];
	
	$result['data2'] = $list['2'];
	
	$result['data3'] = $list['3'];
	
	unset($query,$sorts);
	$query['source'] = $userinfo['id'];
	$sorts['regtime'] = 'desc';
	$resData = _SqlTool::getList('users', $query, array(), $sorts);
	foreach ($resData as $k => $v)
	{
		unset($temp);
		$temp['phone'] = $v['loginname'];
		$temp['yqtime'] = time_formart($v['regtime'],2);
		$result['list1'][] = $temp;
	}
	$result['yqrs'] = count($result['list1']);
	unset($query,$sorts);
	$query['p_userid'] = $userinfo['id'];
	$sorts['id'] = 'desc';
	$resData = _SqlTool::getList('yaoqing', $query, array(), $sorts);
	$result['yqjl'] = _SqlTool::getSum('yaoqing', $query, array(), 'money');
	foreach ($resData as $k => $v)
	{
		unset($query);
		$query['id'] = $v['userid'];
		$user = _SqlTool::getInfo('users', $query);
	
		unset($temp);
		$temp['phone'] = $user['loginname'];
		$temp['yqtime'] = time_formart($user['regtime'],2);
		$temp['touzi'] = $v['touzi'];
		$temp['money'] = $v['money'];
		$result['list2'][] = $temp;
	}
	
	echoJSON($result);